<template>
    <div>
        <div>
            <input type="text" placeholder="账号" v-model="username" />
        </div>
        <div>
            <input type="text" placeholder="密码" v-model="password" />
        </div>
        <div>
            <button @click="login">登录</button>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            username: "order",
            password: "order123"
        };
    },
    methods: {
        login() {
            this.$store
                .dispatch("login", {
                    username: this.username,
                    password: this.password,
                    callback (res) {

                        console.log(res);
                        // location.replace('/');
                    }
                });
        }
    }
};
</script>